/**
 * @author ：wang-ting
 * @Date：2025/4/26 10:42
 */
import java.util.Scanner;
public class 找数组最大值最小值 {
    public static void main(String[] args) {
        int[] ary = new int[6];
        int max = 0;
        int min = 0;
        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i <ary.length ; i++) {
            ary[i]=scanner.nextInt();
        }
        for(int i = 0;i < ary.length;i++){
            for(int j = 0;j < ary.length - 1 - i;j++){
                if(ary[j] > ary[j+1]){
                    int temp = 0;
                    temp = ary[j];
                    ary[j] = ary[j+1];
                    ary[j+1] = temp;
                }
                if(ary[j] < min){
                    min = ary[j];
                }
            }
        }
        max = ary[ary.length-1];
        min = ary[0];


        System.out.println(max+" "+min);
    }
}
